<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>{{ .Site.Title }} - 页面未找到</title>
        <style>
            :root {
                --primary-color: #3f51b5;
                --secondary-color: #ff4081;
                --bg-color: #ffffff;
                --text-color: #333;
                --light-gray: #e0e0e0;
            }

            body {
                font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
                background-color: var(--bg-color);
                color: var(--text-color);
                margin: 0;
                padding: 0;
                display: flex;
                flex-direction: column;
                height: 100vh;
                text-align: center;
                line-height: 1.6;
            }

            .error-container {
                margin: 5rem auto;
                padding: 2rem;
                background: #ffffff;
                border-radius: 8px;
            }

            .error-code {
                font-size: 5rem;
                font-weight: bold;
                color: var(--primary-color);
                margin-bottom: 1rem;
            }

            .error-title {
                font-size: 2rem;
                margin-bottom: 1rem;
                color: var(--primary-color);
            }

            .error-message {
                font-size: 1.2rem;
                margin-bottom: 2rem;
                color: var(--text-color);
            }

            .home-button {
                display: inline-block;
                padding: 0.8rem 1.5rem;
                background-color: var(--primary-color);
                color: white;
                text-decoration: none;
                border-radius: 4px;
                font-weight: bold;
                transition: all 0.3s ease;
                margin: 0.5rem;
            }

            .home-button:hover {
                background-color: var(--secondary-color);
                transform: translateY(-2px);
            }

            .popular-links {
                margin-top: 2rem;
                text-align: left;
            }

            .popular-links h3 {
                color: var(--primary-color);
            }

            .popular-links ul {
                list-style: none;
                padding: 0;
            }

            .popular-links li {
                margin: 0.5rem 0;
            }

            .popular-links a {
                color: var(--primary-color);
                text-decoration: none;
            }

            .popular-links a:hover {
                text-decoration: underline;
                color: var(--secondary-color);
            }

            @media (max-width: 768px) {
                .error-container {
                    margin: 2rem 1rem;
                    padding: 1rem;
                }

                .error-code {
                    font-size: 3rem;
                }

                .error-title {
                    font-size: 1.5rem;
                }
            }
        </style>
    </head>
    <body>
        <div class="error-container">
            <div class="error-code">404</div>
            <h1 class="error-title">页面未找到</h1>
            <p class="error-message">抱歉，您访问的页面不存在或已被移除。</p>

            <a href="{{ "/" | relURL }}" class="home-button">返回首页</a>

            {{ $popular := where .Site.RegularPages "Params.popular" true | first 5 }}
            {{ if $popular }}
            <div class="popular-links">
                <h3>热门内容推荐：</h3>
                <ul>
                    {{ range $popular }}
                    <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
                    {{ end }}
                </ul>
            </div>
            {{ end }}
        </div>
    </body>
</html>